<!DOCTYPE html>
<html>
<head>
    <title>评论我的 - {:config('web.WEB_AUT')}</title>
    {include file="index/header"}
    <link rel="stylesheet" href="/template/default/public/css/user.css">
    <div class="tpt-wp cl">
        <div class="tpt-user cl">
            {include file="public/user"}
            <div class="tpt-tab cl">
                <button class="del_btns tpts-btn layui-btn layui-btn-danger">清空全部消息</button>
                <ul class="mine-msg">
                    {volist name="tptc" id="vo"}
                    <li class="messagelist">
                        <blockquote class="layui-elem-quote">
                            <a href="/home/{$vo.userid}.html" target="_blank">
                                <cite>{$vo.username}</cite>
                            </a>
                            回复了您的内容
                            <a href="/thread/{$vo.fid}.html" target="_blank"><cite>{$vo.title}</cite></a>
                            {if condition="$vo.shows eq 0"}<a style="background: #D63131;" class="mine-edit">待审</a>{/if}
                        </blockquote>
                        <div style="color:#999;font-size: 13px;" class="cl">
                            {$vo.content|content_zh=0,120}...
                        </div>
                        <p><span>{$vo.time|date="Y-m-d",###}</span><a member-id="{$vo.id}" title="清空"
                                                                      class="del_btn layui-btn layui-btn-sm layui-btn-danger fly-delete">清空</a>
                        </p>
                    </li>
                    {/volist}
                </ul>
                <div class="pages cl">{$tptc->render()}</div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        layui.use('form', function () {
            var form = layui.form,
                jq = layui.jquery;
            jq('.del_btn').click(function () {
                var id = jq(this).attr('member-id');
                layer.confirm('确定清空此消息么?', function (index) {
                    loading = layer.load(2, {
                        shade: [0.2, '#000']
                    });
                    jq.post('{:url("index/user/messagedels")}', {'id': id}, function (data) {
                        if (data.code == 200) {
                            layer.close(loading);
                            layer.msg(data.msg, {icon: 1, time: 1000}, function () {
                                location.reload();
                            });
                        } else {
                            layer.close(loading);
                            layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
                        }
                    });
                });
            });
            jq('.del_btns').click(function () {
                layer.confirm('确定清空全部消息么?', function (index) {
                    loading = layer.load(2, {
                        shade: [0.2, '#000']
                    });
                    jq.post('{:url("index/user/messagedelss")}', function (data) {
                        if (data.code == 200) {
                            layer.close(loading);
                            layer.msg(data.msg, {icon: 1, time: 1000}, function () {
                                location.reload();
                            });
                        } else {
                            layer.close(loading);
                            layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
                        }
                    });
                });
            });
        })
    </script>
    {include file="index/footer"}
    </body>
</html>